import request from '@/utils/request'
/**
 * 分页广告类型列表
 * @param pageNum
 * @param pageSize
 */
const getTypeList = function(pageNum, pageSize, params) {
  return request({
    url: '/SysAd/typeList?pageNum='+pageNum+"&pageSize="+pageSize,
    method: 'post',
    data: params != null ? params : {}
  })
}
/*
* 添加新类型
* */
const typeAdd = function(data) {
  return request({
    url: '/SysAd/typeAdd',
    data: data,
    method: 'post'
  })
}
/*
* 更新类型
* */
const typeUpdate = function(date){
  return request({
    url: '/SysAd/typeUpdate',
    data: date,
    method: 'post'
  })
}
/*
* 分页获取广告详情列表
* */
const infoList = function(pageNum, pageSize, adTypeId, params){
  return request({
    url: '/SysAd/infoList?pageNum='+pageNum+"&pageSize="+pageSize+"&adTypeId="+adTypeId,
    method: 'post',
    data: params != null ? params : {}
  })
}
/*
* 添加新类型
* */
const infoAdd = function(data) {
  return request({
    url: '/SysAd/infoAdd',
    data: data,
    method: 'post'
  })
}
/*
* 更新类型
* */
const infoUpdate = function(data){
  return request({
    url: '/SysAd/infoUpdate',
    data: data,
    method: 'post'
  })
}
/*
* base46文件上传
* */
const fileUpload = function(data){
  return request({
    url: '/sysPic/upload',
    data: data,
    method: 'post'
  })
}


export const adApi = {
  getTypeList: getTypeList,
  typeAdd: typeAdd,
  typeUpdate: typeUpdate,
  infoList: infoList,
  infoAdd: infoAdd,
  infoUpdate: infoUpdate,
  fileUpload: fileUpload
}
